<?php TPL::output('m/header.tpl.htm'); ?>

<!-- 搜索栏 -->
<div class="aw-search-bar">
	<form id="search_form" action="m/search/" method="post">
		<input type="text" class="form-control" name="q" placeholder="搜索话题、问题或用户" autocomplete="off" value="<?php echo $this->keyword; ?>" />
		<button class="icon icon-search" type="submit"></button>
	</form>
</div>
<!-- end 搜索栏 -->

<!-- 内容 -->
<div class="container active padding-0">
	<div class="aw-search-result-box">
		<div class="mod-body">
			<!-- 搜索结果 -->
			<div class="mod result-mod">
				<?php if ($_GET['q']) { ?>
				<div class="mod-head">
					<ul id="list_nav" class="category-list">
						<li class="active"><a href="#all" data-toggle="tab"><?php _e('全部'); ?></a></li>
	    				<li><a href="#questions" data-toggle="tab"><?php _e('问题'); ?></a></li>
	    				<li><a href="#topics" data-toggle="tab"><?php _e('话题'); ?></a></li>
	    				<li><a href="#users" data-toggle="tab"><?php _e('用户'); ?></a></li>
					</ul>
				</div>
				<?php } ?>
				<div class="mod-body">
					<ul id="search_result">
					</ul>
				</div>
				<div class="mod-footer">
					<p class="text-center color-999 tips hide"><?php _e('没有搜索结果'); ?></p>
					<p class="text-center color-999 all-result hide"><a href="m/search/q-<?php echo $_GET['q']; ?>"><?php _e('查看全部结果'); ?></a></p>
					<a class="aw-load-more" id="search_result_more" <?php if (!$_GET['q']) { ?>style="display:none;"<?php } ?>><i class="icon icon-loading icon-spin"></i> <span><?php _e('更多'); ?></span></a>
				</div>
			</div>
			<!-- end 搜索结果 -->
		</div>
		<div class="mod-footer">
			<form id="search_publish" action="m/publish/" method="post">
				<p class="text-center">
					<input type="hidden" name="question_content" value="<?php echo $this->keyword; ?>" />
					<button class="btn btn-primary btn-large hide" type="submit"><?php _e('发起该问题'); ?></button>
				</p>
			</form>
		</div>
	</div>
</div>
<!-- end 内容 -->

<script type="text/javascript" src="<?php echo G_STATIC_URL; ?>/js/app/search.js"></script>

<script type="text/javascript">
	<?php if (addslashes($this->keyword)) { ?>
		search_query = '<?php echo addslashes($this->keyword); ?>';
	<?php } else { ?>
		search_query = '<?php echo $_GET['q']; ?>';
	<?php } ?>
	split_query = '<?php echo addslashes($this->split_keyword); ?>';
	ajax_template = 'm';

	$(function()
	{
		$('.aw-search-bar input').focus();
	});
</script>

<?php TPL::output('m/footer.tpl.htm'); ?>